﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using System.Drawing;

namespace mtdsharp
{
    class RouteList
    {
        private List<Route> items;
        public List<Route> Items
        {
            get { return items; }
        }

        private ImageList emblems;
        public ImageList Emblems
        {
            get { return emblems; }
        }

        public RouteList(string[] gtfsLines, int emblemSize)
        {
            this.items = new List<Route>();

            for (int i = 1; i < gtfsLines.Length; i++)
            {
                this.items.Add(new Route(gtfsLines[i], emblemSize));
            }
            this.items.Sort((a, b) => (1000 * (a.Number - b.Number)) + a.Name.CompareTo(b.Name));

            this.emblems = new ImageList();
            this.emblems.ImageSize = new Size(emblemSize, emblemSize);

            for (int i = 0; i < this.items.Count; i++)
            {
                emblems.Images.Add(items[i].Emblem);
            }
        }
    }
}
